import numpy as np


def main():
    a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

    n, m = input().split()
    n = int(n)
    m = int(m)

    if n * m != len(a):
        print("NO")
    else:
        b = np.array(a).reshape(n, m)
        print(b)


if __name__ == '__main__':
    main()
